define(['jquery'], function ($) {
    var countdown_obj = $(".countdown");

    var fn = function (i) {
        var time = countdown_obj.eq(i).data('time');
        var hour, minute, second = 0;

        var obj_hour = countdown_obj.eq(i).find(".countdown-hour");
        var obj_minute = countdown_obj.eq(i).find(".countdown-minute");
        var obj_second = countdown_obj.eq(i).find(".countdown-second");

        //console.log(hour, minute, second);

        setInterval(function () {
            time--;
            hour = Math.floor(time / 3600);
            minute = Math.floor((time % 3600) / 60);
            second = Math.floor((time % 3600) % 60);
            if (hour < 10) {
                obj_hour.html('0' + hour);
            } else {
                obj_hour.html(hour);
            }
            obj_minute.html(minute);
            obj_second.html(second);
        }, 1000);

    }

    /*
    <div class="time countdown-hour">00</div>
            <span class="fg">:</span>
            <div class="time countdown-minute">40</div>
            <span class="fg">:</span>
            <div class="time countdown-second">59</div>*/

    for (var i = 0; i < countdown_obj.length; i++) {
        fn(i);
    }


    // return {
    //     move: mousemove
    // }
});